import os
class_list = ['placeholder','car','people','battery car','bicycle']
pther_path =  'C:\\Users\\kasia\\Desktop\\yz\\labels\\classes.txt'
cjj_path = 'C:\\Users\\kasia\\Desktop\\cjj\\labels\\classes.txt'
cjj_image_path = 'C:\\Users\\kasia\\Desktop\\cjj\\labels/'
yz_image_path = 'C:\\Users\\kasia\\Desktop\\yz\\labels/'
def getNames():

    files =  os.listdir(yz_image_path)

    for file in files:
        _open = open(yz_image_path+file,'r')
        _str = ''
        if file == "classes.txt":
            continue
        for line in _open.readlines():
            _strs = line.split(' ')
            new_str = ''
            if int(_strs[0])==5:
                new_str = 2
                for i in _strs[1:]:
                    new_str = str(new_str) + ' ' +  str(i)
                _str = _str + new_str
            else :
                _str = _str + line
            _open = open(yz_image_path+file,'w')
            _open.write(_str)
        _open.close()
    # file = open(cjj_image_path)

    # delete electromobile 


    # 5  to  2  

    # print(file.read())








if __name__ == "__main__":
    getNames()